-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Improve consistency of exception message formatting. #3536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@jwage please see the comments above. I haven't reviewed the entire patch yet. |
| public function closeCursor() : void | ||
| { | ||
| unset($this->data); | ||
| $this->data = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was adding tests for ArrayStatement and this seemed wrong since it can result in PHP errors if you call other public methods after closeCursor()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes perfect sense.
|
|
||
| if (isset($this->connectionParameters[$shard['id']])) { | ||
| throw new InvalidArgumentException('Shard ' . $shard['id'] . ' is duplicated in the configuration.'); | ||
| throw new InvalidArgumentException(sprintf('Shard "%s" is duplicated in the configuration.', $shard['id'])); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is $shard['id'] a string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's annotated as int|string in most places but looks like it's a numeric string (or an integer):
dbal/lib/Doctrine/DBAL/Sharding/PoolingShardConnection.php
Lines 94 to 96 in 82f5fe3
| if (! is_numeric($shard['id']) || $shard['id'] < 1) { | |
| throw new InvalidArgumentException('Shard Id has to be a non-negative number.'); | |
| } |
Also, the id comes from sys.federation_member_distributions.member_id:
dbal/lib/Doctrine/DBAL/Sharding/SQLAzure/SQLAzureShardManager.php
Lines 158 to 164 in 68e48e8
| $sql = 'SELECT member_id as id, | |
| distribution_name as distribution_key, | |
| CAST(range_low AS CHAR) AS rangeLow, | |
| CAST(range_high AS CHAR) AS rangeHigh | |
| FROM sys.federation_member_distributions d | |
| INNER JOIN sys.federations f ON f.federation_id = d.federation_id | |
| WHERE f.name = ' . $this->conn->quote($this->federationName); |
which according to this article is INT.
These details are mostly for myself, I'll need this info later to finish the work on strict types.
|
@jwage I rebased |
|
@morozov Done! |
| return new self( | ||
| sprintf( | ||
| "Option 'platform' must be an object and subtype of '%s'. Got '%s'", | ||
| 'Option "platform" must be an object and subtype of %s. Got "%s".', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No quotes around type needed.
|
|
||
| throw new UnexpectedValueException("Unrecognized boolean literal '${value}'"); | ||
| throw new UnexpectedValueException(sprintf( | ||
| 'Unrecognized boolean literal, "%s" given.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No quotes around type needed. Or… most likely it will be a printable scalar value. Let's leave it without the GetVariableType.
|
@jwage thanks. Could you look at the build failure and the new comments? Looks like we're really close to finishing it. |
|
Fixed latest feedback and fixed the tests. |
|
Thank you 🚢 |
|
Cool! Thanks! |
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Improve consistency of exception message formatting.
Summary
Improve consistency of exception message formatting. See #3531 for details.
TODO